package com.example.touch.wifipositioning;

import java.util.ArrayList;

public class WifiPositioner {

	private ArrayList<TraceEntry> offlineTraceEntries;
	
	public WifiPositioner()
	{
		Parser parser = new Parser("/IndoorPositioning/Offline1");
		offlineTraceEntries = parser.parse();
	}
	
	public WifiPositioner(String measurementsFolderPath){
		Parser parser = new Parser(measurementsFolderPath);
		offlineTraceEntries = parser.parse();
	}
	
	public PositionCalculationResult fingerPrintNN(TraceEntry onlineTraceEntry)
	{
		FingerPrintingNN fingerNN = new FingerPrintingNN();
		return fingerNN.CalculatePosition(offlineTraceEntries, onlineTraceEntry);
	}
	
	public PositionCalculationResult fingerPrintKNN(int k, TraceEntry onlineTraceEntry)
	{
		FingerPrintingKNN fingerKNN = new FingerPrintingKNN(k, false);
		return fingerKNN.CalculatePosition(offlineTraceEntries, onlineTraceEntry);
	}
	
	public PositionCalculationResult fingerPrintKNNWeighted(int k, TraceEntry onlineTraceEntry)
	{
		FingerPrintingKNN fingerKNNWeighted = new FingerPrintingKNN(k, true);
		return fingerKNNWeighted.CalculatePosition(offlineTraceEntries, onlineTraceEntry);
	}
	
	
    
    
}
